package com.dingjian.mcp.tool;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dingjian.mcp.entity.Users;
import com.dingjian.mcp.service.IUsersService;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class UsersMcpTool {
    @Autowired
    IUsersService iUsersService;

    @Tool(description = "根据用户名称查询用户信息")
    public List<Users> getUsers(@ToolParam(description = "用户名称") String username) {
        QueryWrapper<Users> usersQueryWrapper = new QueryWrapper<>();
        usersQueryWrapper.lambda().like(Users::getUsername, username);
        return iUsersService.list(usersQueryWrapper);
    }
}
